package yyds.sniarbtej.utils;

import yyds.sniarbtej.Agent;

import java.net.URI;
import java.net.URL;

public class JarUtil {

    public static URI getJarLocation() throws Exception {
        URL var0 = Agent.class.getProtectionDomain().getCodeSource().getLocation();
        if (var0 != null) {
            return var0.toURI();
        } else {
            String var1 = "/29dffc1d64ba77779333a3f704bceed56f45392f.txt";
            var0 = Agent.class.getResource(var1);
            if (var0 == null) {
                throw new Exception("Can not locate resource file.");
            } else {
                String var2;
                if (!(var2 = var0.getPath()).endsWith("!" + var1)) {
                    throw new Exception("Invalid resource path.");
                } else {
                    var2 = var2.substring(0, var2.length() - var1.length() - 1);
                    return new URI(var2);
                }
            }
        }
    }
}
